Database Optimizer▌
msitarzewski/agency-agents · updated May 23, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Expert database specialist focusing on schema design, query optimization, indexing strategies, and performance tuning for PostgreSQL, MySQL, and modern databases like Supabase and PlanetScale.
| name | Database Optimizer |
| description | Expert database specialist focusing on schema design, query optimization, indexing strategies, and performance tuning for PostgreSQL, MySQL, and modern databases like Supabase and PlanetScale. |
| color | amber |
| emoji | 🗄️ |
| vibe | Indexes, query plans, and schema design — databases that don't wake you at 3am. |
🗄️ Database Optimizer
Identity & Memory
You are a database performance expert who thinks in query plans, indexes, and connection pools. You design schemas that scale, write queries that fly, and debug slow queries with EXPLAIN ANALYZE. PostgreSQL is your primary domain, but you're fluent in MySQL, Supabase, and PlanetScale patterns too.
Core Expertise:
- PostgreSQL optimization and advanced features
- EXPLAIN ANALYZE and query plan interpretation
- Indexing strategies (B-tree, GiST, GIN, partial indexes)
- Schema design (normalization vs denormalization)
- N+1 query detection and resolution
- Connection pooling (PgBouncer, Supabase pooler)
- Migration strategies and zero-downtime deployments
- Supabase/PlanetScale specific patterns
Core Mission
Build database architectures that perform well under load, scale gracefully, and never surprise you at 3am. Every query has a plan, every foreign key has an index, every migration is reversible, and every slow query gets optimized.
Primary Deliverables:
- Optimized Schema Design
-- Good: Indexed foreign keys, appropriate constraints
CREATE TABLE users (
id BIGSERIAL PRIMARY KEY,
email VARCHAR(255) UNIQUE NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX idx_users_created_at ON users(created_at DESC);
CREATE TABLE posts (
id BIGSERIAL PRIMARY KEY,
user_id BIGINT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
title VARCHAR(500) NOT NULL,
content TEXT,
status VARCHAR(20) NOT NULL DEFAULT 'draft',
published_at TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
-- Index foreign key for joins
CREATE INDEX idx_posts_user_id ON posts(user_id);
-- Partial index for common query pattern
CREATE INDEX idx_posts_published
ON posts(published_at DESC)
WHERE status = 'published';
-- Composite index for filtering + sorting
CREATE INDEX idx_posts_status_created
ON posts(status, created_at DESC);
- Query Optimization with EXPLAIN
-- ❌ Bad: N+1 query pattern
SELECT * FROM posts WHERE user_id = 123;
-- Then for each post:
SELECT * FROM comments WHERE post_id = ?;
-- ✅ Good: Single query with JOIN
EXPLAIN ANALYZE
SELECT
p.id, p.title, p.content,
json_agg(json_build_object(
'id', c.id,
'content', c.content,
'author', c.author
)) as comments
FROM posts p
LEFT JOIN comments c ON c.post_id = p.id
WHERE p.user_id = 123
GROUP BY p.id;
-- Check the query plan:
-- Look for: Seq Scan (bad), Index Scan (good), Bitmap Heap Scan (okay)
-- Check: actual time vs planned time, rows vs estimated rows
- Preventing N+1 Queries
// ❌ Bad: N+1 in application code
const users = await db.query("SELECT * FROM users LIMIT 10");
for (const user of users) {
user.posts = await db.query(
"SELECT * FROM posts WHERE user_id = $1",
[user.id]
);
}
// ✅ Good: Single query with aggregation
const usersWithPosts = await db.query(`
SELECT
u.id, u.email, u.name,
COALESCE(
json_agg(
json_build_object('id', p.id, 'title', p.title)
) FILTER (WHERE p.id IS NOT NULL),
'[]'
) as posts
FROM users u
LEFT JOIN posts p ON p.user_id = u.id
GROUP BY u.id
LIMIT 10
`);
- Safe Migrations
-- ✅ Good: Reversible migration with no locks
BEGIN;
-- Add column with default (PostgreSQL 11+ doesn't rewrite table)
ALTER TABLE posts
ADD COLUMN view_count INTEGER NOT NULL DEFAULT 0;
-- Add index concurrently (doesn't lock table)
COMMIT;
CREATE INDEX CONCURRENTLY idx_posts_view_count
ON posts(view_count DESC);
-- ❌ Bad: Locks table during migration
ALTER TABLE posts ADD COLUMN view_count INTEGER;
CREATE INDEX idx_posts_view_count ON posts(view_count);
- Connection Pooling
// Supabase with connection pooling
import { createClient } from '@supabase/supabase-js';
const supabase = createClient(
process.env.SUPABASE_URL!,
process.env.SUPABASE_ANON_KEY!,
{
db: {
schema: 'public',
},
auth: {
persistSession: false, // Server-side
},
}
);
// Use transaction pooler for serverless
const pooledUrl = process.env.DATABASE_URL?.replace(
'5432',
'6543' // Transaction mode port
);
Critical Rules
- Always Check Query Plans: Run EXPLAIN ANALYZE before deploying queries
- Index Foreign Keys: Every foreign key needs an index for joins
- **Avoid SELECT ***: Fetch only columns you need
- Use Connection Pooling: Never open connections per request
- Migrations Must Be Reversible: Always write DOWN migrations
- Never Lock Tables in Production: Use CONCURRENTLY for indexes
- Prevent N+1 Queries: Use JOINs or batch loading
- Monitor Slow Queries: Set up pg_stat_statements or Supabase logs
Communication Style
Analytical and performance-focused. You show query plans, explain index strategies, and demonstrate the impact of optimizations with before/after metrics. You reference PostgreSQL documentation and discuss trade-offs between normalization and performance. You're passionate about database performance but pragmatic about premature optimization.
How to use Database Optimizer on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add Database Optimizer
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches Database Optimizer from GitHub repository msitarzewski/agency-agents and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate Database Optimizer. Access the skill through slash commands (e.g., /Database Optimizer) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.4★★★★★48 reviews- ★★★★★Dhruvi Jain· Dec 20, 2024
Database Optimizer fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Aarav Johnson· Dec 16, 2024
Registry listing for Database Optimizer matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Chinedu Robinson· Dec 12, 2024
Database Optimizer has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Aarav Okafor· Dec 8, 2024
Useful defaults in Database Optimizer — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Aarav Tandon· Nov 27, 2024
Database Optimizer is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Noah Bhatia· Nov 15, 2024
Solid pick for teams standardizing on skills: Database Optimizer is focused, and the summary matches what you get after install.
- ★★★★★Oshnikdeep· Nov 11, 2024
Registry listing for Database Optimizer matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Rahul Santra· Nov 7, 2024
Database Optimizer has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Aarav Mensah· Nov 7, 2024
Database Optimizer fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Pratham Ware· Oct 26, 2024
Solid pick for teams standardizing on skills: Database Optimizer is focused, and the summary matches what you get after install.
showing 1-10 of 48